﻿@model IEnumerable<QuanLyCayXanh.Models.Report>

@{
    ViewBag.Title = "Index";
}

<h2>Danh sách khảo sát</h2>

<p>
    @Html.ActionLink("Phát triển", "Create", null, new { @class = "pure-button pure-button-primary" })
</p>
<table class="pure-table pure-table-bordered">
    <thead>
        <tr>
            <th>STT</th>
            <th>
                @Html.DisplayNameFor(model => model.Tree.NameVietNam)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Height)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Diameter)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Note)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Rating)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Image)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Video)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Tree.Street.Name)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Tree.Ward.Name)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.DateOfReference)
            </th>            
            <th></th>
        </tr>
    </thead>
    
    @{
        int count = 0;

    }
    @foreach (var item in Model)
    {
        count = count + 1;
        string trClass = count % 2 == 1 ? "" : "pure-table-odd";
        <tr class="@trClass">
            <td>@count</td>
            <td>
                @Html.DisplayFor(modelItem => item.Tree.NameVietNam)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Height)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Diameter)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Note)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Rating)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Image)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Video)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Tree.Street.Name)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Tree.Ward.Name)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.DateOfReference)
            </td>            
            <td>
                <a class="pure-button" href="@Url.Action("Edit", new { id = item.Id })">
                    <i class="fa fa-edit"></i>
                </a>
                <a class="pure-button detail-link" href="@Url.Action("Details", new { id = item.Id })">
                    <i class="fa fa-angle-down"></i>
                </a>
                @{
                    string strname = item.Tree.NameVietNam + "<br> Ngày: "+ item.DateOfReference;
                }
                <a class="pure-button delete-link" name="@strname" href="@Url.Action("Delete", new { id = item.Id })">
                    <i class="fa fa-remove"></i>
                </a>

                @*@Html.ActionLink("Edit", "Edit", new { id = item.Id }) |
                @Html.ActionLink("Details", "Details", new { id = item.Id }, new { @class = "detail-link" }) |
                @Html.ActionLink("Delete", "Delete", new { id = item.Id }, new { @class = "delete-link", name = item.Tree.NameVietNam + "/"+ item.DateOfReference })*@
            </td>
        </tr>
    }

</table>

@Html.Partial("~/Views/Shared/_ActionForm.cshtml")
